<?php

class Default_Form_Login extends App_Form
{

	public function init()
	{
		$this->setMethod('post');
		$this->setAttrib('class', 'form-signin');
		$this->setDescription('Please sign in');

		$email = $this->createElement('email', 'email')
				  ->setRequired()
				  ->addValidator('EmailAddress')
				  ->setAttrib('placeholder', 'Email address')
				  ->setAttrib('class', 'input-block-level first')
				  ->setDecorators(
				  array(
						'ViewHelper',
						array('Errors', array('class' => 'text-error'))
				  ));
		$this->addElement($email);

		$password = $this->createElement('password', 'password')
				  ->setRequired()
				  ->setAttrib('placeholder', 'Password')
				  ->setAttrib('class', 'input-block-level')
				  ->setDecorators(
				  array(
						'ViewHelper',
						array('Errors', array('class' => 'text-error'))
				  ));
		$this->addElement($password);

		$submit = $this->createElement('submit', 'login')
				  ->setRequired()
				  ->setLabel('Sign in')
				  ->setAttrib('class', 'btn btn-large btn-primary')
				  ->setDecorators(
				  array(
						'ViewHelper'
				  ));
		$this->addElement($submit);

		$resetPassword = $this->createElement('button', 'resetpassword')
				  ->setRequired()
				  ->setLabel('Forgot your password?')
				  ->setAttrib('class', 'btn btn-small btn-link')
				  ->setAttrib('data-href', $this->getView()->url(array('controller' => 'user', 'action' => 'lost'), 'default', true))
				  ->setAttrib('data-click', 'url')
				  ->setDecorators(
				  array(
						'ViewHelper'
				  ));
		$this->addElement($resetPassword);

		$this->setDecorators(
				  array(
						array('Description', array('tag' => 'h2', 'class' => 'form-signin-heading')),
						array('FormErrors', array('onlyCustomFormErrors' => true,
								  'class' => 'text-error',
								  'markupListEnd' => '',
								  'markupListItemEnd' => '',
								  'markupListItemStart' => '',
								  'markupListStart' => ''
						)),
						'FormElements',
						'Form'
				  )
		);
	}

}

